// 构造函数：constractor返回创建实例对象时构造函数的引用
function Animal (name) {
    this.name = name
    console.log('我是一只'+this.name);
}
var dog = new Animal('狗')
console.log(dog.constructor===Animal);
// 特点：首字母大写；使用new生成实例函数

// 引申:普通函数创建的实例有没有constructor属性?
function person1 (age){
    this.age = age
}
var p = person1 (21)
// console.log(p.constructor);
// Uncaught TypeError: Cannot read property 'constructor' of undefined

function person2 (age){
    return {
        age:age
    }
}
var p2 = person2 (21)
console.log(p2.constructor===Object); //Object

function person3 (age){
    return function(){
      this.age = age
    }
}
var p3 = person3 (21)
console.log(p3.constructor===Function); //Function

